CREATEPROC[dbo].[asi_ExpireTimedCommitments] @ProductKeyuniqueidentifier AS BEGIN -- Set nocount option to surpress row count messages SETNOCOUNTON -- Declare variables DECLARE@whereClausenvarchar(50) SET@whereClause=' ' IF@ProductKeyisnotnull BEGIN SET@whereClause=' and ProductKey = '''+cast(@ProductKeyasnchar(36))+'''' END
DELETEFROMCommitmentWHEREExpirationDate<GETDATE()+@whereClause END